import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";

export default {
  input: "./src/main.js", // 入口文件
  output: {
    dir: "./dist",
    //   file: "./dist/bundle.js", // 输出文件
    format: "umd", // 输出格式 amd / es / cjs / iife / umd
    name: "func", // 当format为iife和umd时必须提供，将作为全局变量挂在window(浏览器环境)下：window.A=...
    sourcemap: true, // 生成bundle.js.map文件，方便调试
    plugins: [
      terser({
        output: {
          beautify: true,
        },
      }),
    ],
  },
  plugins: [
    commonjs({
      include: /node_modules/,
    }),
    json(),
    resolve(),
  ],
  external: ["lodash"],
};
